package com.qdlc.p2p.biz.processor.task.pay;

import com.qdlc.p2p.biz.processor.event.CashAwardPayCollectNoticeEvent;
import com.qdlc.p2p.biz.processor.task.AbstractTaskProcessor;
import com.qdlc.p2p.biz.service.CollectPayService;
import com.qdlc.p2p.common.core.queue.TaskProcessorException;
import com.qdlc.p2p.common.core.queue.ValueEvent;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created by 51ky on 2016/5/16.
 */
@Service
public class CashAwardPayTaskProcessor  extends AbstractTaskProcessor {

    /** 代付业务处理 */
    @Resource
    @Qualifier("cashAwardPayServiceImpl")
    private CollectPayService cashAwardPayService;

    @Override
    protected void process0(ValueEvent event) throws TaskProcessorException {
        CashAwardPayCollectNoticeEvent cashAwardPayCollectNoticeEvent =  (CashAwardPayCollectNoticeEvent)event;
        cashAwardPayService.requestOrder(cashAwardPayCollectNoticeEvent.getTppTradeLog());
    }

    @Override
    public boolean supports(ValueEvent event) {
        return event instanceof CashAwardPayCollectNoticeEvent;
    }
}
